package org.company.management.utilities;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.wb.swt.ResourceManager;

/**
 * @author J
 *
 */
public class CustomMessageBox
{
	private static Shell _shell;
	private static Button _deleteButton;
	private static Button _okButton;
	
	
	public static boolean showYesNoMessageBox( String title, String message )
	{
		Shell lShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();  
		  
		boolean proceed = MessageDialog.openQuestion(lShell, title, message);
	
		return proceed;
	}
	
	public static void showWarningMessageBox( String title, String message )
	{
		Shell lShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();  
		  
		 MessageDialog.openWarning(lShell, title, message);
		 
	}
	
	public static boolean showCustomWarningMessageBox( String title, String message )
	{
		
		_shell = new Shell();
		_shell.setMinimumSize(new Point(450, 160));
		_shell.setSize(450, 160);
		_shell.setText(Strings.invalidInputHeader);
	    
	    _okButton  = new Button(_shell, SWT.NONE);
	    _okButton.setBounds(349, 85, 75, 25);
	    _okButton.setText(Strings.OK);
	    	
	    Label lblNewLabel = new Label(_shell, SWT.NONE);
	    lblNewLabel.setImage(ResourceManager.getPluginImage(Strings.pluginId, "icons/stop_64x64.png"));
	    lblNewLabel.setBounds(10, 10, 75, 69);
	    
	    Label lblNewLabel_1 = new Label(_shell, SWT.NONE);
	    lblNewLabel_1.setBounds(91, 23, 327, 36);
	    lblNewLabel_1.setText(Strings.invalidInputMessage);
	    _shell.open();

		return false;
		
	}
	
	public static boolean showCustomYesNoMessageBox( String title, String message )
	{
		
		final Shell s = new Shell();
		s.setMinimumSize(new Point(450, 160));
		s.setSize(450, 160);
	    s.setText(Strings.invalidInputHeader);
	    
	    _okButton = new Button(s, SWT.NONE);
	    _okButton.setBounds(349, 85, 75, 25);
	    _okButton.setText(Strings.no);
	    
	    _deleteButton = new Button(_shell, SWT.NONE);
	    _deleteButton.setBounds(268, 85, 75, 25);
	    _deleteButton.setText(Strings.yes);
	    
	    Label lblNewLabel = new Label(s, SWT.NONE);
	    lblNewLabel.setImage(ResourceManager.getPluginImage(Strings.pluginId, "icons/warning_64x64.png"));
	    lblNewLabel.setBounds(10, 10, 75, 69);
	    
	    Label lblNewLabel_1 = new Label(s, SWT.NONE);
	    lblNewLabel_1.setBounds(91, 23, 327, 36);
	    lblNewLabel_1.setText(Strings.confirmSelection);
	    s.open();

		return false;
		
	}
	
}